Skip to content

Solana initial implementation, resolves FRONT-896#82

Merged
arentant merged 15 commits intomain-v2from
dev-solana
Mar 10, 2026
Merged

Solana initial implementation, resolves FRONT-896#82
arentant merged 15 commits intomain-v2from
dev-solana

Conversation

@yasha-meursault
Copy link
Contributor

feat: add Solana blockchain support with HTLC client and wallet integration

  • Implemented SolanaHTLCClient and registration functions in index.ts
  • Created login module for Solana wallet signing
  • Added transaction builder for user lock transactions
  • Defined types for Solana signer and HTLC client configuration
  • Introduced utility function for converting secrets to buffers
  • Configured TypeScript settings for the Solana package
  • Updated pnpm lockfile to include Solana dependencies

…ration

- Implemented SolanaHTLCClient and registration functions in index.ts
- Created login module for Solana wallet signing
- Added transaction builder for user lock transactions
- Defined types for Solana signer and HTLC client configuration
- Introduced utility function for converting secrets to buffers
- Configured TypeScript settings for the Solana package
- Updated pnpm lockfile to include Solana dependencies
@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
trainapp-monorepo Error Error Mar 10, 2026 0:28am

Request Review

…transaction handling with instruction-based approach
…HTLC client

- Use provider.name (not provider.id) for InternalConnector.providerName,
  AccountIdentity.providerName, and all downstream comparisons across
  useConnectors, ConnectorsList, evmConnectorsContext,
  MultichainConnectorPicker, swapAccounts, and AddressPicker

- Surface e.message in UserLockAction error handler (was silently dropping
  errors when only e.name='Error' was present)

- Replace Solana _getSolverLockDetails unbounded loop with
  getSolverLockCount-bounded loop, matching EVM/Starknet pattern

- Remove single-tick setTimeout hack in walletLoginContext Solana path;
  check connected state explicitly instead

- Validate amount string in toBaseUnits before constructing BN

- Fix useHTLCWriteClient to pass resolved rpcUrl to Solana client instead
  of solanaConnection.rpcEndpoint (respects user RPC overrides)

- Eliminate duplicate AnchorProvider construction in _getSolverLockDetails
  by routing through buildProgram with connection override

- Add unit tests for SolanaHTLCClient.getUserLockDetails and refund
  (13 cases covering active lock, closed account log parsing, SOL/token
  paths, missing signer, confirmation errors)
… and guard native SOL by address

- useHTLCWriteClient: call adapter.sendTransaction() directly instead of
  solanaSendTransaction() from context, fixing WalletNotConnectedError
  when adapter is connected but WalletProvider context state is null
- Add NATIVE_SOL_ADDRESS constant ('11111111...') to types.ts
- Replace truthy contractAddress checks with explicit !== NATIVE_SOL_ADDRESS
  guard in transactionBuilder, refund(), and redeemSolver()
- Fix solanaGasProvider: srcLpAddress field name, hashlock as hex string,
  sourceAsset with decimals, as-any cast for dummy estimation params
…uilders

- Replace contractAddress truthiness checks with explicit NATIVE_SOL_ADDRESS
  comparison in transactionBuilder and client (handles null from API correctly)
- Add NATIVE_SOL_ADDRESS constant to constants.ts; replace all hardcoded
  system address strings in client.ts with it
- Extract refundTransactionBuilder and redeemSolverTransactionBuilder from
  client.ts into transactionBuilder.ts; client now only handles sign/send/confirm
- Remove useSolanaWalletStore: signMessage is now read from the live adapter
  directly in walletLoginContext (same pattern as sendTransaction)
- Fix WalletNotConnectedError in useHTLCWriteClient: call adapter.sendTransaction
  directly instead of solanaSendTransaction from WalletProvider context
- Fix gas estimation: correct lpAddress → srcLpAddress, hashlock type,
  contractAddress null-safety, and replace as any with proper dummy params
- Rename phtlcTransactionBuilder export to userLockTransactionBuilder
- Removed the quoteExpiry parameter from the userLock method call, simplifying the parameter list.
- Updated the return statement to include the nonce from params, ensuring a more comprehensive response.

These changes improve the clarity and consistency of the SolanaHTLCClient implementation.
- Updated the signMessage function to directly call signMessage on the connected adapter, improving clarity and reducing unnecessary type casting.
- Removed console log for starknetAccount to clean up the code and maintain focus on essential logic.

These changes enhance the readability and maintainability of the wallet login context implementation.
…ferences

- Added new dependencies: vitest and rimraf to pnpm-workspace.yaml.
- Updated package.json files across multiple packages to reference dependencies from the catalog instead of specific versions for @coral-xyz/anchor, @solana/spl-token, and @solana/web3.js.
- Ensured consistency in devDependencies by changing rimraf and vitest to catalog references in aztec, evm, solana, and starknet packages.

These changes streamline dependency management and improve version control across the workspace.
@arentant arentant merged commit 7f91685 into main-v2 Mar 10, 2026
1 of 2 checks passed
@arentant arentant deleted the dev-solana branch March 10, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants